package com.example.controller;

import com.example.entity.ElevatorAppraisal;
import com.example.ext.entity.ExtElevatorAppraisal;
import com.example.service.ElevatorAppraisalService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * Created by simon on 2017/10/20.
 */
@RestController
public class ElevatorAppraisalController {

    @Autowired
    ElevatorAppraisalService elevatorAppraisalService;

    @ApiOperation(value = "查询评价列表",notes = "查询评价列表")
    @RequestMapping(value="api/appraisal/getElevatorAppraisal",method = RequestMethod.POST)
    Map<String,Object> getElevatorAppraisal(@RequestBody ExtElevatorAppraisal extElevatorAppraisal){

        return elevatorAppraisalService.queryListById(extElevatorAppraisal);
    }


    @ApiOperation(value = "party查询评价列表",notes = "party查询评价列表")
    @RequestMapping(value="api/appraisal/getElevatorAppraisalByParty",method = RequestMethod.POST)
    Map<String,Object> getElevatorAppraisalByParty(@RequestBody ExtElevatorAppraisal extElevatorAppraisal){

        return elevatorAppraisalService.queryListByPartyId(extElevatorAppraisal);
    }

    @ApiOperation(value = "更新回复",notes = "更新回复")
    @RequestMapping(value="api/appraisal/updateFeedBack",method = RequestMethod.POST)
    Map<String,Object> updateFeedBack(@RequestBody ElevatorAppraisal elevatorAppraisal){

        return elevatorAppraisalService.updateFeedBack(elevatorAppraisal);
    }

    @ApiOperation(value = "新增电梯评价",notes = "新增电梯评价")
    @RequestMapping(value="api/appraisal/add",method = RequestMethod.POST)
    Map<String,Object> add(@RequestBody Map<String, Object> elevatorAppraisal){

        return elevatorAppraisalService.add(elevatorAppraisal);
    }

    @ApiOperation(value = "点赞电梯评价",notes = "点赞电梯评价")
    @RequestMapping(value="api/appraisal/good",method = RequestMethod.POST)
    Map<String,Object> good(@RequestBody Map<String, Object> elevatorAppraisal){

        return elevatorAppraisalService.good(elevatorAppraisal);
    }
}
